const api = require('./api.js');

const openVR = ({viewUrl, workNum, success}) => {
  const accountInfo = wx.getAccountInfoSync();
  let envVersion = 'release'
  if (accountInfo.miniProgram.appId !== 'wx1544133dfa2e710f') {
    // 非正式号用体验版
    envVersion = 'trial'
  }
  wx.navigateToMiniProgram({
    appId: 'wx7f92d1bbad252b41',
    path: 'pages/tic/room_webview/index/index',
    envVersion,
    extraData: {
      viewUrl,
      agentId: 'YB_' + workNum
    },
    success: () => {
      if(typeof success === 'function') {
        success()
      }
    },
    fail: (e) => {
      console.log(e)
    },
  })
}

export {
  openVR
}